package com.pro.common.service.sitecontent.model.db;

import com.pro.common.api.CommonConst;
import com.pro.common.service.sitecontent.enums.EnumAuthRouteType;
import com.pro.common.api.enums.EnumSysRole;
import com.pro.common.api.model.BaseConfigModel;
import com.pro.common.api.model.auth.IOpenConfigClass;
import com.pro.common.service.sitecontent.enums.init.IAuthRoute;
import com.pro.common.service.sitecontent.enums.init.IEnumToDbAuthRoute;
import com.pro.framework.api.enums.IEnumToDbDb;
import com.pro.framework.javatodb.annotation.JTDField;
import com.pro.framework.javatodb.annotation.JTDTable;
import com.pro.framework.javatodb.constant.JTDConst;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * 路由表
 *
 * @author admin
 */
@Data
@Schema(description = "菜单路由")
@JTDTable(sequences = {
        "UNIQUE KEY `uk_groupCode_SysRole_serviceName_code` (`group_code`,`service_name`,`sys_role`,`code`)"
}, module = CommonConst.Modules.siteContent)
public class AuthRoute extends BaseConfigModel implements IOpenConfigClass, IEnumToDbAuthRoute {
    @Schema(description = "菜单路由分组")
    @JTDField(entityClass = AuthRouteGroup.class, entityClassLabel = "routeName", defaultValue = "DEFAULT", mainLength = 200, javaTypeEnumClassMultiple = true)
    private String groupCode;
    @Schema(description = "服务名称")
    @JTDField(defaultValue = "NULL", notNull = JTDConst.EnumFieldNullType.can_null)
    private String serviceName;
    @Schema(description = "名称")
    @JTDField(disabled = true)
    private String routeName;
    @Schema(description = "编号")
    private String code;
    @Schema(description = "系统角色")//admin/agent/user
    @JTDField(mainLength = 80)
    private EnumSysRole sysRole;
    @Schema(description = "上级")
    @JTDField(entityClass = AuthRoute.class, entityClassLabel = "routeName")
    private String pcode;
    @Schema(description = "类型")
    private EnumAuthRouteType type;
    @Schema(description = "字体图标")
    private String icon;
    @Schema(description = "图片图标")
    @JTDField(uiType = JTDConst.EnumFieldUiType.image)
    private String pic;
    @Schema(description = "前端路由地址")
    private String componentPath;
    @Schema(description = "后端接口地址权限码")
    private String permissionPaths;
    @Schema(description = "外部链接")
    private String url;
    @Schema(description = "总开关显示")//显示太乱了,强制不显示
    @JTDField(defaultValue = "1")
    private Boolean showFlag;
    @Schema(description = "管理端显示")//功能完整,但未收费隐藏
    @JTDField(defaultValue = "1")
    private Boolean showAdmin;
}
